package com.ccc.scala.base8_match

object Match02 {
  def main(args: Array[String]): Unit = {
    // 匹配常量
    def describe(x: Any) = x match {
      case 5 => "Int five"
      case "hello" => "String hello"
      case true => "Boolean true"
      case '+' => "Char +"
    }

    println(describe(5)) // Int five
    println(describe("hello")) // String hello
    println(describe(true)) // Boolean true
    println(describe('+')) // Char +
    // println(describe('0')) // MatchError 运行时

  }

}
